package com.gtw.modules.sys.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.gtw.modules.dao.TbUserDao;
import com.gtw.modules.entity.SysUserEntity;
import com.gtw.modules.entity.TbUser;
import com.gtw.modules.sys.service.SysTbUserService;
import com.gtw.modules.sys.shiro.ShiroUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/** 用户接口实现类
 * Created by wuye on 2018/1/26.
 */
@Service
public class SysTbUserServiceImpl implements SysTbUserService {

    @Autowired
    private TbUserDao tbUserDao;

    @Override
    public Page<TbUser> queryPageList(Page<TbUser> page, Map<String, Object> map) {
        page.setRecords(tbUserDao.queryPageList(page, map));
        return page;
    }

    @Override
    public void save(TbUser tbUser) {
        tbUserDao.insert(tbUser);
    }

    @Override
    public void update(TbUser tbUser) {
        tbUserDao.updateByPrimaryKey(tbUser);
    }

    @Override
    public TbUser queryObject(int userId) {
        return tbUserDao.selectByPrimaryKey((long) userId);
    }

    @Override
    public List<TbUser> queryTeam(int userId) {
        return tbUserDao.queryTeam(userId);
    }

    @Override
    public void delete(int id) {
    }

    @Override
    public void deleteBatch(int userIds) {
        tbUserDao.deleteByPrimaryKey((long) userIds);
    }
}
